package net.minecraft.src; //THIS TELLS JAVA WHAT MOD THIS CLASS BELONGS TO

import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11; //GIVES US OPENGL

public class LF_EntitySeatTestRenderer extends Render
{
	boolean firstRender = true;

	public LF_EntitySeatTestRenderer()
	{
		super();
	}

	//THE FOLLOWING CODE RENDERS THE ENTITY IN THE WORLD AND ALSO MOVES THE TEXTURE AROUND AS THE PLAYER MOVES AROUND THE ENTITY
	@Override
	public void doRender(Entity entity, double d, double d1, double d2, float yaw, float partialTicks)
	{
		setModel(((LF_EntitySeat)entity).type, ((LF_EntitySeat)entity).subType);
		prevSubType = ((LF_EntitySeat)entity).subType;
		GL11.glPushMatrix();
		GL11.glTranslatef((float)d, (float)d1 + 1.5F, (float)d2);
		GL11.glRotatef(180, 1f, 0, 0);
		GL11.glRotatef(entity.rotationYaw,0,1f,0);
		loadTexture(curTexture);
		GL11.glPushMatrix();
		curModel.renderModel(0.0625F, ((LF_EntitySeat)entity).subType);
		GL11.glPopMatrix();	
		GL11.glPopMatrix();	
	}

	String curTexture = "/LordFlower/TileEntityTextures/LF_WoodenChair.png";
	LF_Model curModel = null;
	byte prevSubType = -1;

	public void setModel(int type, byte subType)
	{
		if(subType != prevSubType)
			curModel = null;
		prevSubType = subType;

		switch(type)
		{
			case 1:
				if(!(curModel instanceof LF_ModelWoodenChairHigh))
					curModel = new LF_ModelWoodenChairHigh();
				curTexture = "/LordFlower/TileEntityTextures/LF_WoodenChair.png";
				break;
			case 16:
				if(!(curModel instanceof LF_ModelSoftChair))
					curModel = new LF_ModelSoftChair();
				curTexture = "/LordFlower/TileEntityTextures/LF_SoftChair.png";
				break;
			default:
				if(!(curModel instanceof LF_ModelWoodenChair))
					curModel = new LF_ModelWoodenChair(subType);
				curTexture = "/LordFlower/TileEntityTextures/LF_WoodenChair.png";
		}
	}
}
